import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {MatTableModule} from '@angular/material/table';
import {FlexLayoutModule} from "@angular/flex-layout";
import {MatButtonModule} from '@angular/material/button';
import {MatInputModule} from '@angular/material/input';
import {MatFormFieldModule} from '@angular/material/form-field';
import { GitRoutingModule } from './git-routing.module';
import { GitManagerComponent } from './git-manager/git-manager.component';
import {MatCardModule} from '@angular/material/card'
import {MatCheckboxModule} from '@angular/material/checkbox';
import {ComponentsModule} from "@common/components/module"
import {GitServiceModule} from "@common/services/git/module"
import {MatDividerModule} from '@angular/material/divider';
import { GitDialogComponent } from './git-dialog/git-dialog.component';
import { FormsModule } from '@angular/forms';
import { AuthDialogComponent } from './auth-dialog/auth-dialog.component';
import { GitMonitorComponent } from './git-monitor/git-monitor.component';
import {MatExpansionModule} from '@angular/material/expansion';
import {MonacoEditorModule} from '../../../ngx-manaco-editor/editor.module';
import {NgxMonacoEditorConfig} from '../../../ngx-manaco-editor/config'
import * as monaco from 'monaco-editor';
import { LogshowerComponent } from './logshower/logshower.component';
import { ProjectDetailComponent } from './project-detail/project-detail.component';
import {MatListModule} from '@angular/material/list';
import {MatTabsModule} from '@angular/material/tabs';
import { DockerImagesComponent } from './dockerimages/dockerimages.component';
import {MatIconModule} from '@angular/material/icon';

import {MatSelectModule} from '@angular/material/select';
import { DockerConfigComponent } from './docker-config/docker-config.component';
import {ScrollingModule} from '@angular/cdk/scrolling';
import { K8sConfigYamlComponent } from './k8s-config-yaml/k8s-config-yaml.component';
import {CreateServiceModule} from '@common/services/create/module';
import { DragableContainComponent } from './git-monitor/dragable-contain/dragable-contain.component';
import { DDbodyComponent } from './git-monitor/ddbody/ddbody.component';
const monacoConfig: NgxMonacoEditorConfig = {
  baseUrl: 'assets',
  defaultOptions: { scrollBeyondLastLine: false },
  onMonacoLoad
};
export function onMonacoLoad() {

  console.log((window as any).monaco);

  const uri = monaco.Uri.parse('a://b/foo.json');
  monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
    validate: true,
    schemas: [{
      uri: 'http://myserver/foo-schema.json',
      fileMatch: [uri.toString()],
      schema: {
        type: 'object',
        properties: {
          p1: {
            enum: ['v1', 'v2']
          },
          p2: {
            $ref: 'http://myserver/bar-schema.json'
          }
        }
      }
    }, {
      uri: 'http://myserver/bar-schema.json',
      fileMatch: [uri.toString()],
      schema: {
        type: 'object',
        properties: {
          q1: {
            enum: ['x1', 'x2']
          }
        }
      }
    }]
  });

}

@NgModule({
  declarations: [
    GitManagerComponent,
    GitDialogComponent,
    AuthDialogComponent,
    GitMonitorComponent,
    LogshowerComponent,
    ProjectDetailComponent,
    DockerImagesComponent,
    DockerConfigComponent,
    K8sConfigYamlComponent,
    DragableContainComponent,
    DDbodyComponent,
  ],
  imports: [
    CommonModule,
    GitRoutingModule,
    MatTableModule,
    MatCardModule,
    MatIconModule,
    ComponentsModule,
    GitServiceModule,
    MatCheckboxModule,
    FlexLayoutModule,
    MatButtonModule,
    MatDividerModule,
    MatFormFieldModule,
    MatInputModule,
    FormsModule,
    MatExpansionModule,
    MatListModule,
    MatTabsModule,
    MatSelectModule,
    ScrollingModule,
    CreateServiceModule,
    MonacoEditorModule.forRoot(monacoConfig),
  ]
})
export class GitModule { }
